<template>
  <div class="result_container">
    <div class="result_box">
      <el-table :data="contestants" stripe height="600" style="width:100%;" >
            <el-table-column width="60" label="排序" align="center">
                <template scope="scope"><span>{{scope.$index + 1}}</span></template>
            </el-table-column>
            <el-table-column min-width="2.1" label="图片" align="center">
                <template slot-scope="scope">
                <img :src="scope.row.image" class="head_pic" style="height:150px"/>
                </template>
            </el-table-column>
            <el-table-column prop="title" label="名称" min-width="1" align="center"></el-table-column>
            <el-table-column prop="tickets" min-width="3" align="center" label="票数">
            <template slot-scope="scope">

            <el-progress :show-text="false" :stroke-width="18" :percentage="(scope.row.tickets)-1+1" :color="colors" >
            </el-progress>
              {{ scope.row.tickets }}
            </template>
            </el-table-column >
        </el-table>
    </div>

  </div>
</template>

<script>
import {listVote} from "@/api/study/vote";

export default {
data(){
  return{
    contestants:[],
    colors: [
      {color: '#1989fa', percentage: 20},
      {color: '#e6a23c', percentage: 40},
      {color: '#5cb87a', percentage: 60},
      {color: '#f56c6c', percentage: 80},
      {color: '#6f7ad3', percentage: 100}
    ],
    queryParams: {}
  }
},
  props: ["votesId"],

  created() {
    this.getList(this.votesId);
  },
  methods:{
  //进行排名

  getList() {
    this.queryParams.votesId = parseInt(this.votesId)
    listVote(this.queryParams).then(response => {
      this.voteList = response.rows;
      this.contestants = this.voteList;
    });
  },
}
}
</script>

<style>

</style>
